using System;
using System.Collections.Generic;
using System.Text;
using WindowsLive.Writer.Api;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace LWSkyDriveAttachment
{
    [ProgId("Sky Drive Attachment")]
    [WriterPluginAttribute("e0648c87-23a4-4411-a0db-0b6fcf550d2c", "Sky Drive Attachment", ImagePath = "icon.png", PublisherUrl = "http://sharpsoft.net", Description = "Insert attachment from Windows Live Sky Drive to Windows Live Writer", Id = "e0648c87-23a4-4411-a0db-0b6fcf550d2c", HasEditableOptions = false)]
    [InsertableContentSource("Sky Drive Attachment", MenuText = "Sky Drive Attachment", SidebarText = "Sky Drive Attachment")]
    public class LWSkyDrivePlugin:ContentSource
    {
        public override System.Windows.Forms.DialogResult CreateContent(System.Windows.Forms.IWin32Window dialogOwner, ref string content)
        {
            DialogResult res = DialogResult.Cancel;
            using (LSDBrowser frm = new LSDBrowser())
            {
                frm.Owner = dialogOwner as Form;
                res = frm.ShowDialog();
                if (res == DialogResult.OK)
                {
                    content = frm.FormattedOutput;
                }
            }
            return res;
        }
    }
}
